﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <script>
         // 成绩统计:作业练习
        var num = prompt('请输入班级总人数');
        var sum = 0;
        var average = 0;
        for (var i =1; i <= num; i++) {
            var scroe = prompt('请输入第' + i + '个的成绩');
            sum = sum + Number(scroe);
        }
        average = sum / num;
        alert('班级总的成绩是' + sum);
        alert('班级平均分是: ' + average);
    </script>
</body>
</html>